package com.molyfun.parents.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.ViewGroup;

import com.molyfun.parents.R;
import com.molyfun.parents.activity.common.listactivity.viewholder.ProductCommentHolder;
import com.molyfun.parents.rest.bean.ProductCommentListResponse;

import java.util.List;

/**
 * Created by william(liuchao.hit@gmail.com).
 * Date:28/07/2017.
 */

public class ProductCommentListAdapter extends BaseAdapter<ProductCommentListResponse.ProductCommentBean> {

    public ProductCommentListAdapter(Context context) {
        super(context);
    }

    public void refreshData(List<ProductCommentListResponse.ProductCommentBean> list) {
        super.refreshData(list);
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new ProductCommentHolder(LayoutInflater.from(parent.getContext())
                .inflate(R.layout.layout_product_comment_cell, parent, false));
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) {
        final ProductCommentListResponse.ProductCommentBean productCommentBean = mList.get(position);
        ProductCommentHolder productCommentHolder = (ProductCommentHolder) holder;
        productCommentHolder.mProductCommentCellView.initData(productCommentBean, position == (mList.size() - 1));
    }

}
